package study.kit.uitls;

import cn.hutool.core.bean.BeanPath;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.nio.charset.Charset;

@Slf4j
public class TableUtils {

    @Test
    public void test() {
        String json = IoUtil.read(ResourceUtil.getStream("table.json"), Charset.defaultCharset());
        JSONObject obj = JSONUtil.parseObj(json);
        //log.info("{}", obj.get("content"));

        JSONArray a = (JSONArray)obj.getByPath("content.s1.rows");
//        log.info("{}", a.size());
        log.info("{}", obj.getByPath("$.content.s1.rows.length()"));
//        log.info("{}", obj.getByPath("$.content.s1.rows[0][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[1][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[2][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[3][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[4][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[5][2]"));
//        log.info("{}", obj.getByPath("content.s1.rows[6]"));
//        log.info("{}", obj.getByPath("content.s1.rows[7]"));
//        log.info("{}", obj.getByPath("content.s1.rows[8]"));
    }
}
